package com.good.msgsys.controller;

import com.good.msgsys.dto.Result;
import com.good.msgsys.dto.ResultCode;
import com.good.msgsys.entity.Log;
import com.good.msgsys.service.LogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author junlong
 * @date 2021/1/5 10:17
 */
@Api(tags = "日志模块")
@RestController
@RequestMapping("/api/log")
public class LogController {
    @Autowired
    private LogService logService;

    // 查询所有日志
    @ApiOperation("查询所有日志")
    @RequestMapping(value = "", method = RequestMethod.GET)
    public Result<List<Log>> findAll() {
        List<Log> logs = logService.findAll();
        return new Result<>(ResultCode.SUCCESS, logs);
    }
}
